#!/usr/bin/python

import time , threading 

def sleep_print():
    time.sleep(2)
    print "hello  from both of us."

def threadcode():
    stdout.write("Hello from the new thread , My name is %s \n" % threading.currentThread().getName())
    sleep_print()

print "Before starting a new thread , my name is %s " threading.currentThread().getName()

t = threading.Thread(target = threadcode, name = "ChildThread")
t.setDaemon(1)

t.start()
stdout.write("hello from the main thread , My name is %s " % threading.currentThread.getName())
sleep_print()

t.join()
